import {defineStore} from "pinia";
import {reqHospitalDetail} from '@/api/hospital/index.ts'
import type {HospitalDetail,HosPitalDetail} from "@/api/hospital/type.ts";
import {ref,reactive} from "vue";
// pinia仓库
const userDetailStore = defineStore('Detail',()=> {
    // 医院详情的数据
    let hospitalInfo = reactive({})

    // 获取医院详情的方法
    const getHospital = async (hoscode:string)=>{
        let result:HospitalDetail = await reqHospitalDetail(hoscode);
        if (result.code==200) {
            hospitalInfo = result.data
            console.log(hospitalInfo)
        }
    }
    return {getHospital,hospitalInfo}
},{
    persist: true
});

export default userDetailStore
